{% extends "base.html" %}
{% block content %}
<script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="/static/js/artDialog/jquery.artDialog.js?skin=default"></script>
<script type="text/javascript" src="/static/js/artDialog/plugins/iframeTools.js"></script>
	<table width="100%" align="center" cellpadding="1" class="aui-ibox-data aui-dotted-split">
	  <thead>
		<tr>
			<th width="20"></th>
			<th align="left" width="100">Send User</th>
			<th align="left" width="120">Email</th>
			<th align="left" width="120">Smtp Server</th>
			<th align="center" width="100">Send Total</th>
			<th align="center" width="120">Today Send Total</th>
			<th align="center" width="90">Day Time Limit</th>
		</tr>
	  </thead>
	  <tbody>
	  {% if mails %}
		{%for m in mails %}
		<tr>
			<td align="left"></td>
			<td align="left">{{m.emailname}}</td>
			<td align="left">{{m.emailadd}}</td>
			<td align="left">{{m.smtp_server}}</td>
			<td align="left">{{m.sendtimes}}</td>
			<td align="left">{{m.daytimes}}</td>
			<td align="left">{{m.daylimit}}</td>
		</tr>
		{% endfor %}
	  {%else%}
	    <tr>
			<td align="center" valign="center" height="60" colspan="14" style="color:green;font-size:16px;line-height: 60px;">No Results !</td>
		</tr>
	  {%endif%}
		<tr>
			<td align="center" colspan="14">
				<div id="pages" class="pager" style='display:none;'></div>
			</td>
		</tr>
	  </tbody>
	</table>
<script>
(function(){
	function initdata(){
		var tolpage = {{tolpage}}
		var page = {{page}}
		var total = {{total}}
		console.log(tolpage,page,total)
		if(tolpage<=1)return false;
		$('#pages').append(tolpage+'&nbsp;pages:')
		$('#pages').show()
		var i = 1;
		if(tolpage>10){
			i=(page-5)>1?page-5:1
			tolpage = tolpage>(page + 5)?page+5:tolpage
		}
		for(i;i<=tolpage;i++){
			var c = ''
			if(i=={{page}}){
				c = 'active'
			}
			$('#pages').append("<li><a href='/watch_from_email_details?group={{groupid}}&page="+i+"&ps={{pagesize}}' class='"+c+"'>"+i+"</a></li>")
		}
		$('#pages').append('&nbsp;&nbsp;Total:&nbsp;'+total)
	}
	initdata()
})()
</script>
{% endblock %}
